package com.zsd.android.opengldemo.view.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import com.zsd.android.opengldemo.model.BaseModel;
import com.zsd.android.opengldemo.presenter.BasePresenter;
import com.zsd.android.opengldemo.view.IBaseView;

public abstract class BaseActivity<V extends IBaseView, M extends BaseModel, P extends BasePresenter<V, M>> extends AppCompatActivity {

    protected P mPresenter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (mPresenter != null) {
            mPresenter.detach();
        }
    }

    protected abstract int layoutId();

    protected abstract P initPresenter();

    protected abstract void initView();
}
